<script src="/lib/layui/xm-select.js"></script>

<div class="layuimini-container layui-anim layui-anim-upbit">
    <div class="layui-row layui-col-space15">
        <!-- 左树 -->
        <div class="layui-col-sm12 layui-col-md2 layui-col-lg2">
            <div class="layui-card">
                <div class="layui-card-body mini-bar" id="ltTree">

                </div>
            </div>
        </div>
        <!-- 右表 -->
        <div class="layui-col-sm12 layui-col-md10 layui-col-lg10">
            <div class="layui-card">
                <div class="layui-card-body">
                    <div class="layui-form toolbar">
                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">数据库</label>
                                <div class="layui-input-inline">
                                    <select name="dataSource" id="dataSource" lay-verify="required" lay-filter="dbcodechange">
                                        <option value="0">应急管理</option>
                                        <option value="1">协同创新</option>
                                        <option value="2">党校期刊</option>
                                        <option value="3">两弹一星</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <div class="layui-input-inline" style="width: 25%;">
                                    <select name="selectkey" id="selectkey" lay-filter="selectchange">
                                        <option value="题名">题名</option>
                                        <option value="作者">作者</option>
                                        <option value="机构">机构</option>
                                    </select>
                                </div>
                                <div class="layui-input-inline mr0">
                                    <input id="edtSearch" class="layui-input" type="text" placeholder="输入关键字" />
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button id="btnSearchByCode" class="layui-btn icon-btn">
                                    <i class="layui-icon layui-icon-search"></i>搜索
                                </button>
                            </div>
                            <div class="layui-inline lungTable">
                                <button id="btnAdd" class="layui-btn icon-btn" 
                                id="dataadd" data-type="dataadd">
                                    <i class="layui-icon">&#xe654;</i>新增
                                </button>
                            </div>
                        </div>
                    </div>
                    <div class="layui-tab layui-tab-brief" lay-filter="tab-all">
                        <ul class="layui-tab-title" id="tabHeader">
                            <li data-status="wx" class="layui-this">文献</li>
                            <li data-status="pic">图片</li>
                            <li data-status="vid">视频</li>
                        </ul>
                        <div class="layui-tab-content">
                            <div class="layui-tab-item layui-show">
                                <table class="layui-table" id="Tablewx" lay-filter="Tablewx"></table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-table" id="Tablepic" lay-filter="Tablepic"></table>
                            </div>
                            <div class="layui-tab-item">
                                <table class="layui-table" id="Tablevid" lay-filter="Tablevid"></table>
                            </div>
                        </div>
                    </div>
            </div>
        </div>
        </div>
    </div>
</div>

<style type="text/css">
    .layui-table-cell{
        text-align:center;

        height: auto;

        white-space: normal;

    }

    .layui-table img{
        max-width:300px
    }

    .layui-table-cell .layui-form-checkbox[lay-skin=primary] {
        top: 0px;
        padding: 0;
    }
</style>


<script type="text/html" id="barDemo">
    {{# if($("#dataSource").val() == "2"){ }}
     <a class="layui-btn layui-btn-normal layui-btn-xs dispatch-clerk" lay-event="addqkxq">添加</a>
    {{# } }}
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
    
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    
</script>

<script type="text/html" id="imgtmp">
    <img title="{{d.title}}"  src="http://218.89.178.103:805/tp/images/{{d.fileName}}" onclick="imgcli(this)" >
  </script>

  <script type="text/html" id="imgbook">
    <img title="{{d.bookName}}"  src="http://218.89.178.103:805/tp/bdqk/cover/{{d.compile}}.jpg?t={{new Date().getTime()}}" 
    onclick="imgcli(this)" width="150" height="190">
  </script>

  <script type="text/html" id="imgldyx">
    <img title="{{d.bookName}}"  src="http://218.89.178.103:805/tp/ldyx/coverpicture/{{d.compile}}.jpg?t={{new Date().getTime()}}" 
    onclick="imgcli(this)" width="150" height="190">
  </script>

  <script type="text/html" id="videotmp">
    <img title="{{d.title}}" src="http://218.89.178.103:805/tp/video/coverPicture/{{d.pictureAddress}}" 
    onclick="videocli(this)" data-src="http://218.89.178.103:805/tp/video/file/{{d.fileName}}">
</script>
 

<script>
        //协同创新
        var xtcxcls = config.xtcxcls;
        //应急管理
        var yjglcls = config.yjglcls;
        //党校期刊
        var dxqkcls =config.dxqkcls;
        var dxqkclsbd = config.dxqkclsbd;
        var ldyxcls = config.ldyxcls;
        //文献
        var wxcars = [[
            { type: 'numbers', align: "center", title: '序号' },
            { field: 'title', align: 'center', sort: true, title: '题名' },
            { field: 'publishDate', align: 'center', width: 110,sort: true, title: '发表时间' },
            { field: 'sourceDatabase', align: 'center', width: 120,sort: true, title: '来源数据库' },
            { fixed: 'right', title: '操作', width: 140, align: 'center', toolbar: '#barDemo' }
            ]];
            //图片
            var piccars = [[
            { type: 'numbers', align: "center", title: '序号' },
            { field: 'title', align: 'center', sort: true, title: '题名' },
            { field: 'imgListTitle', align: 'center',  title: '图片' ,templet:'#imgtmp'},
            { fixed: 'right', title: '操作', width: 140, align: 'center', toolbar: '#barDemo' }
            ]];
            //视频
            var vidcars = [[
            { type: 'numbers', align: "center", title: '序号' },
            { field: 'title', align: 'center', sort: true, title: '题名' },
            { field: 'videoImgTitle', align: 'center',  title: '视频',templet:'#videotmp' },
            { fixed: 'right', title: '操作', width: 140, align: 'center', toolbar: '#barDemo' }
            ]];

            //党校期刊
            var dxcars =[[
                { type: 'numbers', align: "center", title: '序号' },
                { field: 'area', align: 'center', width: 120,sort: true, title: '地区' },
                { field: 'bookName', align: 'center', width: 120,sort: true, title: '书名' },
                { field: 'sponsor', align: 'center', width: 200,sort: true, title: '主办单位' },
                { field: 'chiefEditor', align: 'center', width: 120,sort: true, title: '主编' },
                { field: 'imgListTitle', align: 'center', title: '封面',templet:'#imgbook' },
                { fixed: 'right', title: '操作', width: 190, align: 'center', toolbar: '#barDemo' }
            ]];

            //两弹一星文献
            var ldyxwxcars = [[
                { type: 'numbers', align: "center", title: '序号' },
                { field: 'title', align: 'center', sort: true, title: '题名' },
                { field: 'sponsor', align: 'center', width: 120, title: '主办单位' },
                { field: 'sourceDatabase', align: 'center', width: 120,sort: true, title: '来源数据库' },
                { fixed: 'right', title: '操作', width: 140, align: 'center', toolbar: '#barDemo' }
                ]];

            //两弹一星书籍
            var ldyxsjcars = [[
                { type: 'numbers', align: "center", title: '序号' },
                { field: 'title', align: 'center', sort: true, title: '题名' },
                { field: 'sponsor', align: 'center', width: 200,sort: true, title: '主办单位' },
                { field: 'chiefEditor', align: 'center', width: 120,sort: true, title: '主编' },
                { field: 'imgListTitle', align: 'center', title: '封面',templet:'#imgldyx' },
                { fixed: 'right', title: '操作', width: 140, align: 'center', toolbar: '#barDemo' }
                ]];

    layui.use(['layer', 'form', 'table', 'tree','element',], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var element = layui.element;
        var dtree = layui.tree;
        form.render();
        var cls = yjglcls; //默认为协同创新树
        var page = 1; var pageSize = 10;
        element.on('tab(tab-all)', function (data) {
            $('#btnSearchByCode').click();
        });

        //实例化table，表id,数据库,类型（文献/图片/视频）,表头，检索条件，检索词，数节点list
        function getList(position,status,lxstatus,mycars,keyword,value,code,orderByValue) {
            table.render({
                elem: '#'+position
                , method: 'post'
                , url: config.server +'/dataProcessing/retrieval'
                ,contentType:'application/json'
                , request: {
                 pageName: 'page' //页码的参数名称，默认：page
                , limitName: 'pageSize' //每页数据量的参数名，默认：limit
                    
                }
                , response: {
                   statusCode: 200 //规定成功的状态码，默认：0
                } 
                , where: {
                    type: status,
                    transportType:lxstatus,
                    searchType:keyword,
                    searchValue:value,
                    codeList:code,
                    orderBy:orderByValue,
                    orderByValue:'desc',
                }
                , limit: 10
                , limits: [5, 8, 10]
                , height: 'full-260'
                , cellMinWidth: 101 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                , cols: mycars
                , page: true
               , parseData: function (res) { //将原始数据解析成 table 组件所规定的数据
                   return {
                       "code": res.code, //解析接口状态
                       "msg": res.msg, //解析提示文本
                       "count": res.data.count, //解析数据长度
                       "data": res.data.list  //解析数据列表
                   };
               },
            });

            active = {
                dataadd: function () {
                    adddata();
                },
                dataaddxq: function () {
                    adddataxq();
                },
            }

            $('.lungTable .layui-btn').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });


            table.on('tool('+position+')', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
                
                var data = obj.data; //获得当前行数据
                var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
                var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）
                if (layEvent === 'del') { //删除
                    layer.confirm('确认删除？', function (index) {
                        Del(data.sysID, data.tableName,data.compile);
                        table.reload(position, {
                            page: {
                                curr: 1 //重新从第 1 页开始
                            },
                        });
                        layer.close();//向服务端发送删除指令
                    });
                }
                else if(layEvent=='addqkxq'){
                    var content = layui.miniPage.getHrefContent('mypages/usual/dataMgt/databdqk.html');
                    layer.open({
                        type: 1,
                        id:'LAY_layuixq',
                        skin: 'layui-layer-rim',
                        title: "目录",
                        area: ['1080px', '680px'],
                        maxmin: true, //最大最小化
                        content: content, //引用的弹出层的页面层的方式加载修改界面表单
                        btn: ['关闭','关闭全部'],
                        success: function(index, layero){
                            
                            layui.form.val('component-formxq', {
                                "sno": data.compile,//党校期刊编号
                            });
                            $('#xqSearchbtn').click();//弹窗的初始化查询
                            
                        },
                        yes: function(index){
                            layer.close(index);
                        },
                        btn2: function(index){
                            layer.closeAll();
                        }
                    })
                }
                else if (layEvent === 'edit') { //编辑
                    var content = layui.miniPage.getHrefContent('mypages/usual/dataMgt/addData.html');
                    layer.open({
                        //layer提供了5种层类型。可传入的值有：0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
                        type: 1,
                        skin: 'layui-layer-rim',
                        title: "编辑",
                        area: ['880px', '480px'],
                        maxmin: true, //最大最小化
                        content: content, //引用的弹出层的页面层的方式加载修改界面表单
                        btn: ['保存', '取消'],
                        success: function (layero, index) { // 成功弹出后回调
                            // 解决按enter键重复弹窗问题
                            $(':focus').blur();
                            // 添加form标识
                            layero.addClass('layui-form');
                            // 将保存按钮改变成提交按钮
                            layero.find('.layui-layer-btn0').attr({
                                'lay-filter': 'addRole',
                                'lay-submit': ''
                            });
                            // 刷新渲染(否则开关按钮会不显示)
                            form.render('checkbox');
                            layui.form.val('component-form-group', {
                                "type": status,
                                "transportType": lxstatus,
                                "code": data.code,//行业分类代码
                                "title": data.title,
                                "txurl": status =="2" ? data.compile : data.fileName,
                                "sysID": data.sysID,
                                "selectdb": status,
                                "selecttype": lxstatus,
                                "database":data.tableName,//数据库
                                "bookName":data.bookName,//书名
                                "sponsor":data.sponsor,//主办单位
                                "chiefEditor":data.chiefEditor,//主编
                                "year":data.year,//年
                                "stage":data.stage,//期
                                "totalPeriod":data.totalPeriod,//总期
                                "area":data.area,//地区
                                "classify":data.classify, //分类
                                "compile":data.compile,//党校期刊编号
                                "oldfileName": status =="2" ? data.compile: data.fileName,
                                "oldfilPictureName": lxstatus =="2" ? data.pictureAddress: data.compile
                            });
                            setCode(data.code, status =="2" ? data.compile : data.fileName,data.pictureAddress,data.compile);
                            changeuplod(lxstatus);
                            changeuploaddx(status);
                        },
                        yes: function (index, layero) { // 确认按钮回调函数
                            // 监听提交按钮
                            form.on('submit(addRole)', function (data) {
                                var formData = new FormData($("#popdataadd")[0]);
                                var file = formData.get('fileName');
                                var filep =formData.get('filePictureName');
                                if(formData.get('type') == "2"){
                                    var bookname = formData.get('bookName');
                                    
                                    if (!regKeyWord(bookname)) {
                                        layer.alert("输入非法字符，请检查！");
                                        return false;
                                    }
                                    if (filep == null || filep == "") {
                                        layer.alert("请选择封面！");
                                        return false;
                                    } 
                                    if (file == null || file == "") {
                                        layer.alert("请选择文件！");
                                        return false;
                                    } 

                                }else{
                                    var title = formData.get('title');
                                    if (!regKeyWord(title)) {
                                        layer.alert("输入非法字符，请检查！");
                                        return false;
                                    }
                                    if(formData.get('type') == "3"){
                                        if (file == null || file == "") {
                                            layer.alert("请选择文件！");
                                            return false;
                                        } 
                                        if(lxstatus == "1" ){
                                            if (filep == null || filep == "") {
                                                layer.alert("请选择封面！");
                                                return false;
                                            }  
                                        }
                                    }
                                }

                                $.ajax({
                                    url: config.server +'/dataProcessing/update',
                                    data: formData,
                                    type: "post",
                                    dataType: "json",
                                    headers: {
                                        token: shared.getCookie('token'),
                                    },
                                    cache:false,
                                    contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作，从而失去分界符，而使服务器不能正常解析文件
                                    processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data，而是直接使用data
                                    success: function (msg) {
                                        if (msg.code == 200) {
                                            layer.msg("保存成功!");
                                            layer.close(index);//成功就关闭弹窗
                                            $('#btnSearchByCode').click(); 
                                        } else {
                                            layer.msg(msg.msg);
                                        }
                                    },
                                    error: function (e) { }
                                });

                                return false;//这里加个return false;就不会两次提交
                            });
                        },
                        btn2: function (index, layero) { // 取消按钮回调函数
                            layer.close(index); // 关闭弹出层
                        }
                    });                       
                }
            });
        }

         // 树形渲染
        var dictTree; 
        ptable = function(){ 
                dictTree = dtree.render({
                elem: '#ltTree'
                ,data:cls 
                ,id:'Treelt'
                ,showLine: false //是否开启连接线
                ,showCheckbox: true //开启复选框
                ,oncheck: function (obj) {
                    $('#btnSearchByCode').click();
                }
            });
        }
        ptable();
       
        //搜索按钮点击事件
        $('#btnSearchByCode').click(function () {
            var status= $("#dataSource").val(); //库
            var keyword = $('#selectkey').val(); //检索字段
            var value = $('#edtSearch').val(); //检索词
            if (!regKeyWord(value)) {
                    layer.alert("输入非法字符，请检查！");
                    return "";
                }
            var mycars = wxcars;//默认文献
            var orderByValue = "题名"; //排序
            var lxtype = $('.layui-tab-title .layui-this').attr('data-status');
            var position = 'Table' + lxtype;
            
            switch (lxtype) {
                case "wx":  lxstatus =0; 
                    mycars = wxcars;
                    if(status == 3){
                        mycars = ldyxwxcars; //两弹一星文献
                    } 
                    break; // 默认文献
                case "pic": lxstatus= 1; mycars = piccars;
                    if(status == 3){
                        mycars =ldyxsjcars;//两弹一星书籍
                    }
                    break; // 图片
                case "vid": lxstatus= 2; mycars = vidcars;break; // 视频
                default:  break;
            }
            
            if(status == 2){
                mycars = dxcars;
                orderByValue = "书名";
            }
            
            form.render('select');

            var checkData = getCheckedId(dictTree.getChecked('Treelt'));
            
            getList(position,status,lxstatus,mycars,keyword,value,checkData,orderByValue);
        });
        

        // 获取tree选中节点的id
        function getCheckedId(jsonObj) {
            var id = [];
            $.each(jsonObj, function (index, item) {
                id.push(item.id);
                var i = getCheckedId(item.children);
                if (i.length != 0) {
                    id.push.apply(id,i);
                }
            });
            return id;
        }
        
        //根据select选择框变化，左边树变化
        form.on('select(dbcodechange)', function (data) {
            var t= '<option value="题名">题名</option><option value="作者">作者</option><option value="机构">机构</option>';
            $('#tabHeader li:eq(1)').text('图片');
            $('#tabHeader li:eq(2)').show();
            if(data.value == "0"){
                cls = yjglcls;
                $('#tabHeader').attr("style","display:block");
                
            }else if(data.value == "1"){
                cls = xtcxcls;
                $('#tabHeader').attr("style","display:block");
                
            }else if(data.value == "2"){
                cls = dxqkclsbd;
                $('#tabHeader').attr("style","display:none");
                t='<option value="书名">书名</option><option value="主办单位">主办单位</option><option value="主编">主编</option>';
            }else{
                cls = ldyxcls;
                $('#tabHeader').attr("style","display:block");
                $('#tabHeader li:eq(1)').text('书籍');
                $('#tabHeader li:eq(2)').hide();
                t='<option value="题名">题名</option><option value="主办单位">主办单位</option><option value="主编">主编</option>';
            }
            $('#selectkey').empty();
            $('#selectkey').append(t);
            //form.render('select');
            //dictTree.reload('Treelt',{data:cls}); //重载树
            ptable();
            $('#btnSearchByCode').click();
        });
    
    });
      
    $('#btnSearchByCode').click(); //初始化查询


    //点击图片预览
    function imgcli(obj) {
        layer.photos({
                photos: {
                    "title": obj.title,
                    "start": 0,
                    "data": [{
                        "src": obj.src
                    }]
                }
                ,closeBtn: 1 //是否显示关闭按钮
            });
    }

    //点击视频预览
    function videocli(obj){
        debugger
        let content = '<video width="100%" height="90%"  controls="controls" autobuffer="autobuffer"  autoplay="autoplay" loop="loop">' +
            '<source src="' + obj.dataset.src + '" type="video/mp4"></source></video>';
        layer.open({
            type: 1,
            maxmin: true, //打开放大缩小按钮
            title: obj.title,
            area: ['65%', '65%'],
            content: content,
        });
    }

    //弹窗
    function adddata(){
        var status= $("#dataSource").val(); //库
        var lxtype = $('.layui-tab-title .layui-this').attr('data-status');
        var lxstatus = null;
        switch (lxtype) {
            case "wx":  lxstatus =0;  break; // 默认文献
            case "pic": lxstatus= 1; break; // 图片
            case "vid": lxstatus= 2; break; // 视频
            default:  break;
        }
        var content = layui.miniPage.getHrefContent('mypages/usual/dataMgt/addData.html');

        layer.open({
            type: 1,
            title: '新增',
            skin: 'layui-layer-skin', //样式类名
            area: ['970px', '550px'],//宽高自适应
            id: 'LAY_layuipro',
            shade: 0,//遮罩透明度
            shadeClose: true,
            maxmin: true, //最大最小化
            content: content,
            success: function (layero,index) {
                 // 解决按enter键重复弹窗问题
                 $(':focus').blur();
                    // 添加form标识
                    layero.addClass('layui-form');
                    // 将保存按钮改变成提交按钮
                    layero.find('.layui-layer-btn0').attr({
                        'lay-filter': 'addRole',
                        'lay-submit': ''
                    });
                    // 刷新渲染(否则开关按钮会不显示)
                    form.render('checkbox');

                                      
                    layui.form.val('component-form-group', {
                        "type": status,
                        "transportType": lxstatus,
                        "sysID": "0",
                        "selectdb": status,
                        "selecttype": lxstatus,
                    });
                    getShow(status,lxstatus);
                    changeuplod(lxstatus);
                    changeuploaddx(status);
            },
            btn: ['确认','取消'],
            //确认按钮事件
            yes: function (index, layero) {
                // 监听提交按钮
                form.on('submit(addRole)', function (data) {
                        var formData = new FormData($("#popdataadd")[0]);
                        if(formData.get('type') == "2"){
                            var bookname = formData.get('bookName');
                            var file = formData.get('fileName');
                            var filep =formData.get('filePictureName');
                            if (bookname == null || bookname == "") {
                                layer.alert("请输入书名！");
                                return false;
                            } 
                            if (!regKeyWord(bookname)) {
                                layer.alert("输入非法字符，请检查！");
                                return false;
                            }
                            if (formData.get('area') == null || formData.get('area') == "") {
                                layer.alert("请选择地区！");
                                return false;
                            } 
                            if (formData.get('classify') == null || formData.get('classify') == "") {
                                layer.alert("请选择分类！");
                                return false;
                            } 
                            if (filep == null || filep == "") {
                                layer.alert("请选择封面！");
                                return false;
                            } 
                            if (file == null || file == "") {
                                layer.alert("请选择文件！");
                                return false;
                            } 
                        }else{
                            var title = formData.get('title');
                            if (title == null || title == "") {
                                layer.alert("请输入题名！");
                                return false;
                            } 
                            if (!regKeyWord(title)) {
                                layer.alert("输入非法字符，请检查！");
                                return false;
                            }
                            if(formData.get('type') == "3"){
                                var file = formData.get('fileName');
                                var filep = formData.get('filePictureName');
                                if (file == null || file == "") {
                                    layer.alert("请选择文件！");
                                    return false;
                                } 
                                if(lxstatus == "1" ){
                                    if (filep == null || filep == "") {
                                        layer.alert("请选择封面！");
                                        return false;
                                    }  
                                }
                            }
                        }
                        var urlld="/dataProcessing/insert";
                        //if(status == 3){
                        //    urlld="/dataProcessing/insertLdyxData";
                        //}
                        $.ajax({
                            url: config.server +urlld,
                            data: formData,
                            type: "post",
                            dataType: "json",
                            headers: {
                                token: shared.getCookie('token'),
                            },
                            cache:false,
                            contentType: false, //jax 中 contentType 设置为 false 是为了避免 JQuery 对其操作，从而失去分界符，而使服务器不能正常解析文件
                            processData: false, //当设置为true的时候,jquery ajax 提交的时候不会序列化 data，而是直接使用data
                            success: function (msg) {
                                if (msg.code == 200) {
                                    layer.msg("保存成功!");
                                    layer.close(index);//成功就关闭弹窗
                                    $('#btnSearchByCode').click();
                                } else {
                                    layer.msg(msg.msg);
                                }
                            },
                            error: function (e) { }
                        });
                            return false;//这里加个return false;就不会两次提交
                    });
            },
            //取消按钮事件
            btn2:function (index, layero) {
                layer.close(index);
            },
        })
    }

    //删除
    function Del(sysid,dbcode,compile) {
        
        $.ajax({
            type: "POST",
            headers: {
                    token: shared.getCookie('token'),
                 },
            url: config.server +'/dataProcessing/delete',
            data: JSON.stringify({ "sysID": sysid,"database":dbcode,"compile":compile}),
            contentType: 'application/json',
            dataType: "json",
            crossDomain: true,
            cache:false,
            success: function (msg) {
                if (msg.code == 200 ) {
                    layer.alert('操作成功！', { icon: 6 });
                    layer.close();
                    $('#btnSearchByCode').click(); 
                }
                else {
                    layer.alert('操作失败！请联系管理员', { icon: 5 });
                }
            },
            error: function (e) {
                layer.alert('操作失败！请联系管理员', { icon: 5 });
            }
        })
    }


    //关键词过滤
    function regKeyWord(value) {
        var reg = /^[^~?!@#$%^&*<>,.；]+$/;
        if (value != "" && !reg.test(value)) {
            return false;
        }
        else {
            return true;
        }
    }

</script>
